<?php 
include  "./../protected.php"; /*Valida el inico de sesion*/
?>
<!doctype html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <title>Actualizar usuarios</title>
  <link rel="stylesheet" type="text/css" href="mtb.css"/>
  <link rel="stylesheet" type="text/css" href="main.css"/>
  <link rel="stylesheet" type="text/css" href="ceGrid.css"/>
   <script type="text/javascript" src="../../../js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="../../../css/index.css" />
</head>

<?php
require '../../conexionBD/cecndb.php';
$id=$_GET['id'];
$SQLstr = "SELECT GS05COUS ,GS05NOUS,GS05PASS FROM gs05regusu WHERE GS05COUS = '".$id."'";
$EjecutaCSQL = $conectarBD->query($SQLstr);
while ($registros = $EjecutaCSQL->fetch_row())
{    
   $vNOAC=$registros[1];
   $vDOCA=$registros[2];
}
$conectarBD->close();
?>
<a class="btn" href='index.php'>Listar usuarios</a>
<body>
  <div id="content-mt">
    <div id="div01"  class="curved" >
        <form name="Registroact" id="form-usu" method="post" action="update.php" class="style" >         
            <table id = "tab01">
              <tr>
                <div id="error"></div>
         <td>Usuario</td>
         <td><label>
             <input type="text" name="Txt_GS05COUS" id="COUS" value="<?php echo $id ?>"   maxlength="20" ReadOnly/> 
         </label></td>
    </tr>
    <tr> <td>Nombre completo</td>
         <td><label>
         <input type="text" name="Txt_GS05NOUS" id="NOUS"  value="<?php echo $vNOAC?>" maxlength="50" /> 
         </label>
    </tr>
    <tr>
         <td>Contraseña</td>
         <td><label>
         <input type="password" name="Txt_GS05PASS" id="PASS" value="<?php echo $vDOCA?>"  maxlength="50" ReadOnly/> 
         </label></td>
     </tr>

        <tr>
       <td>Tipo Usuario</td>
       <td><label>
           <div class="col-lg-2">
          <select class="form-control" name='Txt_GS06DEOP' id="DEOP" value = ""  maxlength="50" >
           <option value ="0">Seleccione</option>
           <option value="Administrador">Administrador</option>
            <option value?"Usuario">Usuario</option>
          </select>
            </div>
       </label></td>
   </tr>
      <tr>
         <td></td>
         <td><label>
         <input class="btn-m" type="submit" name="Agregar_Btn" id="Agregar_Btn" value="Cambiar" />
         </label></td>
     </tr>

   </table> 
</form>
</div>
</div>
</body>
<script type="text/javascript">
    
    $(function(){
        $("#COUS").focus();
    $("#form-usu").submit(function(e){
        e.preventDefault();
    var form_data= {    
           COUS:$("#COUS").val(),
           NOUS:$("#NOUS").val(),
           PASS:$("#PASS").val(),
           DEOP:$("#DEOP").val(),

        };

        $.ajax({
          type:"POST",
            url:"Update.php",
            data:form_data,
            success: function(responde){

                     $("#COUS").val("");
                     $("#NOUS").val("");
                     $("#PASS").val("");
                     $("#DEOP").val("");

               
                    $("#error").html(responde);
            }

        });
    });
    });
</script>
</html>